#ifndef __CONTROL_H_
#define __CONTROL_H_

#include "includes.h"



typedef struct
{
		 float   Kp;
		 float   Ki;
		 float   Kd;
		 float			Integral;
		 float      Bias;
		 float      Last_Bias;
		 float      Pre_Bias;
}PID_TypDef;



extern int flag_go;
extern float w_value[11];
extern PID_TypDef mr_pid,ml_pid;
extern PID_TypDef s_pid;
extern float r_speed,l_speed;
extern float target_speed;

void get_adc(void);
void control_func(void);

void PID_init(PID_TypDef* sptr);
void PID_Set(PID_TypDef *PID,float Kp,float Ki,float Kd);
float IncPID(int Encoder,int Target,PID_TypDef* sptr);
float PstPID(float Angle, float Target,PID_TypDef* sptr);




#endif
